import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';

import { terser } from 'rollup-plugin-terser'; // 导入 terser 插件

export default {
    input: 'node_modules/axios/dist/axios.min.js',
    output: {
        file: 'dist/bundle.js',
        format: 'es', // 输出为 ES Module
    },
    plugins: [
        resolve(), // 解析模块路径
        commonjs(), // 将 CommonJS 转换为 ES Module
        terser(),
        copy({
            targets: [
                { src: 'types/', dest: 'dist' }, // 手动复制 types 目录到 dist
            ],
        }),
    ],
};
